clear;
s=MeasurementSession.SimpleMeasurement('./SimpleMeasurement/SIMPLE_DEVICE.dat');

tek=s.getDevice('tek');

[device, props] = ziCreateAPISession('dev3546', 6);

% r=double(ziDAQ('getInt', '/dev3571/scopes/0/time'));
% l=ziDAQ('getDouble', '/dev3571/scopes/0/length');
%
% SamplingRate = 1.8e9/pow2(r);
% t=l/SamplingRate;
%%
ziDAQ('unsubscribe', '*');
ziDAQ('sync');

% Subscribe to the scope's data
ziDAQ('subscribe', ['/' device '/scopes/0/wave']);

% First, poll data without triggering enabled
poll_length = 1;%20e-6; % [s]
poll_timeout = 500; % [ms]
tic;
disp('ready to poll');
tek.forceTrigger;
pause(0.2);
tek.forceTrigger;

data = ziDAQ('poll', poll_length, poll_timeout);

toc
% for k = 1:10
%     pause(0.5);
%     data = ziDAQ('poll', poll_length, poll_timeout);
%     plot(data.dev2127.scopes.wave.wave.')
% end
% Unsubscribe from any streaming data
ziDAQ('unsubscribe', '*');
